<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@include file="/include/common/formbackhead.jsp"%>
<%!
private class PageAction extends BaseAction{
	ResultSet rs = null;
	
	//准备action的环境变量 每次请次都会执行此方法 可在此方法中初如化一些变量
	protected void prepareActionEnv() throws Exception{
		
	}
	
	//加載頁面默認數據
	protected boolean onLoadDefault() throws Exception{
		if(!form.isNullOrEmpty("%%{pkAliasName}%%")){
			rs = utils.executeQuery("%%{right_datasource}%%","%%{right_sql}%% where %%{pkName}%% = '"+form.gpsv("%%{pkAliasName}%%")+"'");
			if(rs.next()){
				form.FromResultSet(rs, false);
				if("0".equalsIgnoreCase(form.gpsv("enab"))){
					ret.setWarningInfo("此單已取消!");
					page.getToolbar().disableAllButtonExcept("newnext");
				}
			}else{
				ret.setWarningInfo("此單已刪除,如需要請重新新增!");
				page.getToolbar().disableAllButtonExcept("newnext");
			}
		}
		return true ;
	}
	
	//处理储存驗證
	protected void onSaveValidate() throws Exception{
		%%{savevalidatecode}%%
	}
	
	//執行儲存
	protected void doSave() throws Exception{
		//1.儲存
		%%{savecode}%%
	}
	
%%{cancelCode}%%

%%{deleteCode}%%
}
%>
<%@include file="/include/common/formbackend.jsp"%>